<template>
	<div class="allcontainer">
		<div class="h2">获奖记录</div>
		<div class="table">
			<el-table :data="data" v-loading="loading" stripe :max-height="tableHeight" highlight-current-row style="width: 100%;">
				<el-table-column type="index" label="序号" width="60" fixed="left"></el-table-column>
				<el-table-column label="奖项" min-width="240">
					<template slot-scope="scope">
						<div style="text-align: left;">
							{{parseInt(scope.row.Type)===1?(scope.row.PrizeTitle?scope.row.PrizeTitle+' - ':''):(scope.row.Title?scope.row.Title+' - ':'')}}  {{scope.row.ActivityTypePrizeTitle}}
						</div>
					</template>
				</el-table-column>
				<el-table-column label="来源" min-width="140">
					<template slot-scope="scope">
						{{parseInt(scope.row.Type)===1?'活动':'积分'}}
					</template>
				</el-table-column>
				<el-table-column prop="Score" label="分值" min-width="100"></el-table-column>
				<el-table-column prop="ActivityName" label="活动" min-width="200"></el-table-column>
				<!-- <el-table-column prop="AddTime" label="时间" width="200"></el-table-column> -->
			</el-table>
			<!-- <el-pagination
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page="pagination.currentPage"
				:page-sizes="pagination.pageSizeOptions"
				:page-size="pagination.pageSize"
				layout="total, sizes, prev, pager, next, jumper"
				:total="pagination.total"
			></el-pagination> -->
		</div>
	</div>
</template>

<script>
import Func from '@/utils/func';
import moment from 'moment'
import Cache from '@/utils/cache';
import { GetPrizePageListCenter,UserActivityMemberPrizeDoGetPageList } from '@/api/follow';
const data = [];
export default {
	components: {
	},
	data() {
		return {
			data,
			form: this.$form.createForm(this, {
				name: 'advanced_search'
			}),
			pagination: {
				currentPage: 1,
				pageSize: this.global.pageSize,
				pageSizeOptions: this.global.pageSizeOptions, // 每页中显示的数据
				showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
			},
			UserInfo: Cache.get('myInfo'),
			addIf: false,
			text: {},
			loading: false,
			values: {},
			pages: {
				pageIndex: 1,
				pageSize: 20
			},
			tableHeight: parseFloat(window.innerHeight - 160),
			NewsTypeList:[],
		};
	},
	computed: {},
	created() {
		this.getList();
		// this.getOtherList()
	},
	mounted() {},
	methods: {
		moment,
		handleOpenChange(status){
			this.yearPickShow = status
		},
		handlePanelChange(value, mode){
			this.gradeYear = moment(value).format('YYYY')
			this.yearPickShow = false
		},
		yearChange(date, dateString){
			if(!date){
				this.gradeYear = null
			}
		},
		newsdetail(item) {
			this.$router.push({
				name: 'UserNewsDetail',
				query: {
					ID: item.ID,
				}
			})
		},
		handleSearch(e) {
			e.preventDefault();
			this.form.validateFields((error, values) => {
				this.pagination.currentPage = 1;
				this.values = values;
				if(this.gradeYear){
					this.values.grade = this.gradeYear
				}
				this.getList();
			});
		},
		handleReset() {
			this.form.resetFields();
			this.values = {};
			this.gradeYear = null
			this.getList();
		},
		handleSizeChange(val) {
			this.pagination.pageSize = val;
			this.getList();
		},
		handleCurrentChange(val) {
			this.pagination.currentPage = val;
			this.getList();
		},
		async getList() {
			this.loading = true;
			let data = {};
			if (this.values) {
				data = this.values;
			}
			data.pageIndex = this.pagination.currentPage;
			data.pageSize = this.pagination.pageSize;
			let res = await UserActivityMemberPrizeDoGetPageList({UserNo:this.UserInfo.UserNo});
			this.loading = false;
			this.data = res.data.data;
			// const pagination = { ...this.pagination };
			// pagination.total = res.data.pageInfo.TotalItemCount;
			// this.pagination = pagination;
		},
		async getOtherList(){
			let res = await GetNewsTypeList()
			this.NewsTypeList = res.data.data
		},
		addList() {
			this.text = {};
			this.addIf = !this.addIf;
		},
		modifyList(text) {
			text = Object.assign(text, { time: new Date() });
			this.addIf = !this.addIf;
			this.text = text;
		},
		deleteList(text) {
			let that = this
			this.$confirm({
				title: '提示',
				content: `您确定删除该学生组织吗？`,
				okText: '确认',
				cancelText: '取消',
				async onOk() {
					let data = {}
					data.id = text.ID
					let res = await DeleteNews(data);
					if(res.data.code==0){
						that.getList()
						that.$message.success(res.data.msg)
					}else{
						that.$message.error(res.data.msg)
					}
				}
			});
		},
		seeList(text,name){
			let path = ''
			if(name == 'teacher'){
				path='ClubTeacher'
			}else if(name=='manage'){
				path='ClubManagerList'
			}else{
				path='ClubMember'
			}
			this.$router.push({
				name: path,
				query: {
					ID: text.ID
				}
			});
		},
		closeFun() {
			this.addIf = false;
			this.getList()
		}
	}
};
</script>

<style lang="less" scoped>
.home-form {
	margin:20px;
	background: #F8FCFF;
	padding:20px;
	border-radius: 12px;
	.ant-col{
		width:19%;
		margin-right:1%;
		&.option{
			margin-top:25px;
		}
		/deep/.ant-form-item {
			margin-bottom: 10px !important;
		}
		/deep/.ant-form-item-label {
			height:20px;
			line-height:20px;
			font-weight: 400;
			color: #8798AD;
		}
		/deep/.ant-input{
			height: 32px;
			background: #FFFFFF;
			border: 1px solid #DDDEE4;
			border-radius:0px;
		}
		/deep/.ant-select-selection{
			height: 32px;
			background: #FFFFFF;
			border: 1px solid #DDDEE4;
			border-radius:0px;
		}
	}
}
</style>
